

int reverse(int x) {
    int tag = 0;
    long long num = 0;
    while (x != 0)
    {
        num = 10 * num + x % 10;
        x = x / 10;
    }
    if (num > INT_MAX || num < INT_MIN)
    {
        return 0;
    }
    return num;
}





/*
    if(head==NULL)
        return NULL;
    struct ListNode* prev = NULL;
    struct ListNode* cur = head;
    struct ListNode* nex = head->next;
    while(cur)
    {
        cur->next = prev;
        prev = cur;
        cur = nex;
        if(nex!=NULL)
        {
            nex = nex->next;
        }
        
    }

    return prev;*/